<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="root">
    <!-- 父组件中调用子组件 -->
    <Child>
      <h1 slot="header">我是后台的头部</h1>
      <!-- 组件里面面的内容，用户自定义 -->
      <div>匿名插槽--内容</div>
      <h3 slot="footer">底部声明</h3>
    </Child>
  </div>


  <!-- 定义组件模板区域 -->
  <script type="text/x-template" id="child">
  <div>
    <header>
      <slot name="header">头部</slot>
      <hr>
    </header>
    <div>
      <slot></slot>
    </div>
    <footer>
      <hr>
      <slot name="footer">底部</slot>
    </footer>
    
  </div>
  </script>
  <script src="./js/vue.js"></script>
  <script>
    const Child = {
      template: '#child'
    }


    new Vue({
      el: '#root',
      data:{
      },
      components: {
        Child
      }
    })
  </script>
</body>

</html>